/**
 * 2013 2013-5-9
 */
package com.surfilter.dp.util;

import java.awt.Component;
import java.awt.Dimension;
import java.awt.Toolkit;

/**
 * 
 */
public class ViewUtil {
	
	/**
	 * 让一个Component居中
	 * @param cmp
	 */
	public static void toCenter(Component cmp) {
		Dimension d = cmp.getSize();
		Dimension screenD = Toolkit.getDefaultToolkit().getScreenSize();
		int x = (int)(screenD.getWidth()-d.getWidth())/2;
		int y = (int)(screenD.getHeight()-d.getHeight())/2;
		cmp.setLocation(x,y);
	}
	

}
